package com.tony.multipledatasources.mapper.mysql;

import com.tony.multipledatasources.entity.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * @author Xuxiaoyu
 * @Description
 * @createTime 2024/4/12 上午10:19:15
 */
@Mapper
public interface StudentMapper {

    @Select("select * from Student")
    /*@Results(value = {
            @Result(column = "s_no", property = "sno", javaType = String.class),
            @Result(column = "sname", property = "sname", javaType = String.class),
            @Result(column = "ssex", property = "ssex", javaType = String.class)
    })*/
    @ResultMap(value = "s1")
    List<Map<String, Object>> getAllStudentsWithMap();

    //@ResultMap(value = "students")
    @Select("select t.* from Student t")
    @Results(id = "s1", value = {
            @Result(column = "s_no", property = "sno", javaType = String.class),
            @Result(column = "sname", property = "sname", javaType = String.class),
            @Result(column = "ssex", property = "ssex", javaType = String.class)
    })
    List<Student> getAllStudentsWithBean();
}
